﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A.HTMlServer
{
    public class Control
    {
        public Control()
        {
 
        }

        public static List<ArticleModel> List = new List<ArticleModel>();
        public static List<HListModel> HList = new List<HListModel>();
        public static object objState =new object();
        public static bool ActiveState = false;

        public static void Run()
        {
            lock (objState)
            {
                if (!ActiveState)
                {
                    MThread mt;
                    for (int i = 0; i < 10; i++)
                    {
                        mt = new MThread();
                        mt.start();
                        ActiveState = true;
                    }
                }
            }
        }
        public static void AddList(List<HListModel> HM)
        {
            
            //要锁吗?
            lock (objState)
            {
                HList.AddRange(HM);
            }
            //启动线程
            Run();
        }
    }
}
